﻿using System;

namespace PageAdmin.Utils
{
    /// <summary>
    /// 分页信息类
    /// </summary>
    [Serializable]
    public class PageInfo
    {
        private int _CurrentPage = 1;
        private int _PageSize = 15;

        /// <summary>
        /// 每页显示数
        /// </summary>
        public int PageSize
        {
            get { return _PageSize; }

            set
            {
                if (value <= 0)
                {
                    _PageSize = 15;
                }
                else
                {
                    _PageSize = value;
                }
            }
        }
        /// <summary>
        /// 总页数
        /// </summary>
        public int PageCount { get; set; } = 1;

        /// <summary>
        /// 总记录数
        /// </summary>
        public int RecordCount { get; set; } = 0;

        /// <summary>
        /// 当前页码
        /// </summary>
        public int CurrentPage
        {
            get
            {
                return _CurrentPage;
            }
            set
            {
                if (value <= 0)
                {
                    _CurrentPage = 1;
                }
                else
                {
                    _CurrentPage = value;
                }
            }
        }
    }

}
